package com.kjzy.api.client;

import com.kjzy.api.fallback.UserClientFallbackFactory;
import com.kjzy.api.pojo.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

//声明feign的客户端
////用于指定要调用服务的名称
//user-service就是服务提供者配置文件中spring.application.name
@FeignClient(value = "user-service",fallbackFactory = UserClientFallbackFactory.class)
public interface UserClient {
////调用某个服务提供者接口的地址 这里就是UserController里面的getUser方法
    @GetMapping("/user/{id}")
    public User getUserById(@PathVariable("id") int id);
}
